import std.conv;
import std.stdio;

import core.stdc.stdlib;
void main()
{
    ulong a =145646;
    writeln("to a  =", to!int(a));
    writeln("cast a  =", cast(int)(a));
    
    string aa = "123456789";
    ubyte[] bb = cast(ubyte[])aa;
    ubyte[] dd = new ubyte[9];
    dd[] = bb[];
    dd[1] = '5';
    writeln("bb = ",cast(string)bb);
    writeln("dd = ",cast(string)dd);
    dd[0..3] = bb[6..9];
     writeln("bb = ",cast(string)bb);
    writeln("dd = ",cast(string)dd);
    void * p = malloc(9);
    ubyte[] hh = cast(ubyte[])p[0..9];
    hh[] = dd;
     
    writeln("dd = ",cast(string)dd);
    writeln("hh = ",cast(string)hh);
    hh[3..6] = dd[6..9];
    writeln("dd = ",cast(string)dd);
    writeln("hh = ",cast(string)hh);
    hh[] = '0';
    dd[] = ubyte.init;
     writeln("dd = ",cast(string)dd);
    writeln("hh = ",cast(string)hh);
    
    import std.socket;
    
    string ip = "2000::1:2345:6789:abcd";
    Address adr = parseAddress(ip,80);
    writeln(adr.addressFamily(), "  ", adr.toString());
}
